/*
 * Copyright (C) 2015 Jack Jiang(cngeeker.com) The BeautyEye Project.
 * All rights reserved.
 * Project URL:https://github.com/JackJiang2011/beautyeye
 * Version 3.6
 *
 * Jack Jiang PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 * __IconFactory__.java at 2015-2-1 20:25:37, original version by Jack Jiang.
 * You can contact author with jb2011@163.com.
 */
package com.lijinjiang.beautyeye.ch1_titlepane;

import javax.swing.*;

import com.lijinjiang.beautyeye.utils.RawCache;

import java.awt.*;
import java.net.URL;

// TODO: Auto-generated Javadoc

/**
 * 普通图片工厂类.
 * @author Jack Jiang
 * @version 1.0
 */
public class __IconFactory__ extends RawCache<ImageIcon> {

    /**
     * 相对路径根（默认是相对于本类的相对物理路径）.
     */
    public final static String IMAGES_ROOT = "images";

    /**
     * The instance.
     */
    private static __IconFactory__ instance = null;

    /**
     * Gets the single instance of __IconFactory__.
     * @return single instance of __IconFactory__
     */
    public static __IconFactory__ getInstance() {
        if (instance == null)
            instance = new __IconFactory__();
        return instance;
    }

    /* (non-Javadoc)
     * @see com.lijinjiang.beautyeye.utils.RawCache#getResource(java.lang.String, java.lang.Class)
     */
    @Override
    protected ImageIcon getResource(String relativePath, Class baseClass) {
        URL resource = baseClass.getResource(relativePath);
        return new ImageIcon(resource);
    }

    /**
     * Gets the image.
     * @param relativePath the relative path
     * @return the image
     */
    public ImageIcon getImage(String relativePath) {
        return getRaw(relativePath, this.getClass());
    }

    /**
     * 窗口关闭图标.
     * @return the internal frame close icon
     */
    public ImageIcon getFrameCloseIcon() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_close_normal_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_close_normal.png");
    }

    /**
     * 窗口关闭图标.
     * @return the internal frame close icon
     */
    public ImageIcon getFrameCloseIcon_rover() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_close_rover_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_close_rover.png");
    }

    /**
     * 窗口关闭图标.
     * @return the internal frame close icon
     */
    public ImageIcon getFrameCloseIcon_pressed() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_close_pressed_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_close_pressed.png");
    }

    /**
     * 窗口最小化图标.
     * @return the internal frame min icon
     */
    public ImageIcon getFrameMinIcon() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_maxwin_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_maxwin.png");
    }

    /**
     * 窗口最小化图标.
     * @return the internal frame min icon
     */
    public ImageIcon getFrameMinIcon_rover() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_maxwin_rover_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_maxwin_rover.png");
    }

    /**
     * 窗口最小化图标.
     * @return the internal frame min icon
     */
    public ImageIcon getFrameMinIcon_pressed() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_maxwin_pressed_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_maxwin_pressed.png");
    }

    /**
     * 窗口最大化图标.
     * @return the internal frame max icon
     */
    public ImageIcon getFrameMaxIcon() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_max_normal_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_max_normal.png");
    }

    /**
     * 窗口最大化图标.
     * @return the internal frame max icon
     */
    public ImageIcon getFrameMaxIcon_rover() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_max_rover_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_max_rover.png");
    }

    /**
     * 窗口最大化图标.
     * @return the internal frame max icon
     */
    public ImageIcon getFrameMaxIcon_pressed() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_max_pressed_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_max_pressed.png");
    }

    /**
     * 窗口恢复图标.
     * @return the internal iconfied icon
     */
    public ImageIcon getIconfiedIcon() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_min_normal_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_min_normal.png");
    }

    /**
     * 窗口恢复图标.
     * @return the internal iconfied icon
     */
    public ImageIcon getIconfiedIcon_rover() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_min_rover_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_min_rover.png");
    }

    /**
     * 窗口恢复图标.
     * @return the internal iconfied icon
     */
    public ImageIcon getIconfiedIcon_pressed() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/frame_min_pressed_4k.png");
        }
        return getImage(IMAGES_ROOT + "/frame_min_pressed.png");
    }


    /**
     * Gets the frame icon_16_16.
     * @return the frame icon_16_16
     */
    public ImageIcon getFrameIcon_16_16() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/default_frame_icon_4k.png");
        }
        return getImage(IMAGES_ROOT + "/default_frame_icon.png");
    }

    /**
     * Gets the frame title head bg_active.
     * @return the frame title head bg_active
     */
    public ImageIcon getFrameTitleHeadBg_active() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/head_bg_4k.png");
        }
        return getImage(IMAGES_ROOT + "/head_bg.png");
    }

    /**
     * Gets the frame title head bg_inactive.
     * @return the frame title head bg_inactive
     */
    public ImageIcon getFrameTitleHeadBg_inactive() {
        Object resolution = UIManager.get("Screen.Resolution");
        if (resolution != null && "4K".equalsIgnoreCase(resolution.toString())) {
            return getImage(IMAGES_ROOT + "/head_inactive_4k.png");
        }
        return getImage(IMAGES_ROOT + "/head_inactive.png");
    }

    /**
     * Gets the internal frame setup icon.
     * @return the internal frame setup icon
     */
    public ImageIcon getFrameSetupIcon() {
        return getImage(IMAGES_ROOT + "/frame_setup_normal.png");
    }
}
